package com.siliconlabs.bledemo.features.configure.gatt_configurator.utils

import com.siliconlabs.bledemo.features.configure.gatt_configurator.models.*

class GattUtils {
    companion object {
        fun get16BitServices(): List<Service16Bit> {
            return arrayListOf(
                    Service16Bit(0x1800, "Generic Access"),
                    Service16Bit(0x1811, "Alert Notification Service"),
                    Service16Bit(0x1815, "Automation IO"),
                    Service16Bit(0x180F, "Battery Service"),
                    Service16Bit(0x183B, "Binary Sensor"),
                    Service16Bit(0x1810, "Blood Pressure"),
                    Service16Bit(0x181B, "Body Composition"),
                    Service16Bit(0x181E, "Bond Management Service"),
                    Service16Bit(0x181F, "Continuous Glucose Monitoring"),
                    Service16Bit(0x1805, "Current Time Service"),
                    Service16Bit(0x1818, "Cycling Power"),
                    Service16Bit(0x1816, "Cycling Speed and Cadence"),
                    Service16Bit(0x180A, "Device Information"),
                    Service16Bit(0x183C, "Emergency Configuration"),
                    Service16Bit(0x181A, "Environmental Sensing"),
                    Service16Bit(0x1826, "Fitness Machine"),
                    Service16Bit(0x1801, "Generic Attribute"),
                    Service16Bit(0x1808, "Glucose"),
                    Service16Bit(0x1809, "Health Thermometer"),
                    Service16Bit(0x180D, "Heart Rate"),
                    Service16Bit(0x1823, "HTTP Proxy"),
                    Service16Bit(0x1812, "Human Interface Device"),
                    Service16Bit(0x1802, "Immediate Alert"),
                    Service16Bit(0x1821, "Indoor Positioning"),
                    Service16Bit(0x183A, "Insulin Delivery"),
                    Service16Bit(0x1820, "Internet Protocol Support Service"),
                    Service16Bit(0x1803, "Link Loss"),
                    Service16Bit(0x1819, "Location and Navigation"),
                    Service16Bit(0x1827, "Mesh Provisioning Service"),
                    Service16Bit(0x1828, "Mesh Proxy Service"),
                    Service16Bit(0x1807, "Next DST Change Service"),
                    Service16Bit(0x1825, "Object Transfer Service"),
                    Service16Bit(0x180E, "Phone Alert Status Service"),
                    Service16Bit(0x1822, "Pulse Oximeter Service"),
                    Service16Bit(0x1829, "Reconnection Configuration"),
                    Service16Bit(0x1806, "Reference Time Update Service"),
                    Service16Bit(0x1814, "Running Speed and Cadence"),
                    Service16Bit(0x1813, "Scan Parameters"),
                    Service16Bit(0x1824, "Transport Discovery"),
                    Service16Bit(0x1804, "Tx Power"),
                    Service16Bit(0x181C, "User Data"),
                    Service16Bit(0x181D, "Weight Scale")
            )
        }

        fun get16BitCharacteristics(): List<Characteristic16Bit> {
            return arrayListOf(
                    Characteristic16Bit(0x2A7E, "Aerobic Heart Rate Lower Limit"),
                    Characteristic16Bit(0x2A84, "Aerobic Heart Rate Upper Limit"),
                    Characteristic16Bit(0x2A7F, "Aerobic Threshold"),
                    Characteristic16Bit(0x2A80, "Age"),
                    Characteristic16Bit(0x2A5A, "Aggregate"),
                    Characteristic16Bit(0x2A43, "Alert Category ID"),
                    Characteristic16Bit(0x2A42, "Alert Category ID Bit Mask"),
                    Characteristic16Bit(0x2A06, "Alert Level"),
                    Characteristic16Bit(0x2A44, "Alert Notification Control Point"),
                    Characteristic16Bit(0x2A3F, "Alert Status"),
                    Characteristic16Bit(0x2AB3, "Altitude"),
                    Characteristic16Bit(0x2A81, "Anaerobic Heart Rate Lower Limit"),
                    Characteristic16Bit(0x2A82, "Anaerobic Heart Rate Upper Limit"),
                    Characteristic16Bit(0x2A83, "Anaerobic Threshold"),
                    Characteristic16Bit(0x2A58, "Analog"),
                    Characteristic16Bit(0x2A73, "Apparent Wind Direction"),
                    Characteristic16Bit(0x2A72, "Apparent Wind Speed"),
                    Characteristic16Bit(0x2AA3, "Barometric Pressure Trend"),
                    Characteristic16Bit(0x2A19, "Battery Level"),
                    Characteristic16Bit(0x2A49, "Blood Pressure Feature"),
                    Characteristic16Bit(0x2A35, "Blood Pressure Measurement"),
                    Characteristic16Bit(0x2A9B, "Body Composition Feature"),
                    Characteristic16Bit(0x2A9C, "Body Composition Measurement"),
                    Characteristic16Bit(0x2A38, "Body Sensor Location"),
                    Characteristic16Bit(0x2AA4, "Bond Management Control Point"),
                    Characteristic16Bit(0x2AA5, "Bond Management Features"),
                    Characteristic16Bit(0x2A22, "Boot Keyboard Input Report"),
                    Characteristic16Bit(0x2A32, "Boot Keyboard Output Report"),
                    Characteristic16Bit(0x2A33, "Boot Mouse Input Report"),
                    Characteristic16Bit(0x2AA8, "CGM Feature"),
                    Characteristic16Bit(0x2AA7, "CGM Measurement"),
                    Characteristic16Bit(0x2AAB, "CGM Session Run Time"),
                    Characteristic16Bit(0x2AAA, "CGM Session Start Time"),
                    Characteristic16Bit(0x2AAC, "CGM Specific Ops Control Point"),
                    Characteristic16Bit(0x2AA9, "CGM Status"),
                    Characteristic16Bit(0x2A5C, "CSC Feature"),
                    Characteristic16Bit(0x2A5B, "CSC Measurement"),
                    Characteristic16Bit(0x2A2B, "Current Time"),
                    Characteristic16Bit(0x2A66, "Cycling Power Control Point"),
                    Characteristic16Bit(0x2A65, "Cycling Power Feature"),
                    Characteristic16Bit(0x2A63, "Cycling Power Measurement"),
                    Characteristic16Bit(0x2A64, "Cycling Power Vector"),
                    Characteristic16Bit(0x2A99, "Database Change Increment"),
                    Characteristic16Bit(0x2A85, "Date of Birth"),
                    Characteristic16Bit(0x2A86, "Date of Threshold Assessment"),
                    Characteristic16Bit(0x2A08, "Date Time"),
                    Characteristic16Bit(0x2A0A, "Day Date Time"),
                    Characteristic16Bit(0x2A09, "Day of Week"),
                    Characteristic16Bit(0x2A7D, "Descriptor Value Changed"),
                    Characteristic16Bit(0x2A7B, "Dew Point"),
                    Characteristic16Bit(0x2A56, "Digital"),
                    Characteristic16Bit(0x2A0D, "DST Offset"),
                    Characteristic16Bit(0x2A6C, "Elevation"),
                    Characteristic16Bit(0x2A87, "Email Address"),
                    Characteristic16Bit(0x2A0C, "Exact Time 256"),
                    Characteristic16Bit(0x2A88, "Fat Burn Heart Rate Lower Limit"),
                    Characteristic16Bit(0x2A89, "Fat Burn Heart Rate Upper Limit"),
                    Characteristic16Bit(0x2A26, "Firmware Revision String"),
                    Characteristic16Bit(0x2A8A, "First Name"),
                    Characteristic16Bit(0x2A8B, "Five Zone Heart Rate Limits"),
                    Characteristic16Bit(0x2AB2, "Floor Number"),
                    Characteristic16Bit(0x2A01, "Appearance"),
                    Characteristic16Bit(0x2AA6, "Central Address Resolution"),
                    Characteristic16Bit(0x2A00, "Device Name"),
                    Characteristic16Bit(0x2A04, "Peripheral Preferred Connection Parameters"),
                    Characteristic16Bit(0x2A02, "Peripheral Privacy Flag"),
                    Characteristic16Bit(0x2A03, "Reconnection Address"),
                    Characteristic16Bit(0x2A05, "Service Changed"),
                    Characteristic16Bit(0x2A8C, "Gender"),
                    Characteristic16Bit(0x2A51, "Glucose Feature"),
                    Characteristic16Bit(0x2A18, "Glucose Measurement"),
                    Characteristic16Bit(0x2A34, "Glucose Measurement Context"),
                    Characteristic16Bit(0x2A74, "Gust Factor"),
                    Characteristic16Bit(0x2A27, "Hardware Revision String"),
                    Characteristic16Bit(0x2A39, "Heart Rate Control Point"),
                    Characteristic16Bit(0x2A8D, "Heart Rate Max"),
                    Characteristic16Bit(0x2A37, "Heart Rate Measurement"),
                    Characteristic16Bit(0x2A7A, "Heat Index"),
                    Characteristic16Bit(0x2A8E, "Height"),
                    Characteristic16Bit(0x2A4C, "HID Control Point"),
                    Characteristic16Bit(0x2A4A, "HID Information"),
                    Characteristic16Bit(0x2A8F, "Hip Circumference"),
                    Characteristic16Bit(0x2ABB, "HTTPS Security"),
                    Characteristic16Bit(0x2ABA, "HTTP Control Point"),
                    Characteristic16Bit(0x2AB9, "HTTP Entity Body"),
                    Characteristic16Bit(0x2AB7, "HTTP Headers"),
                    Characteristic16Bit(0x2AB8, "HTTP Status Code"),
                    Characteristic16Bit(0x2A6F, "Humidity"),
                    Characteristic16Bit(0x2A2A, "IEEE 11073-20601 Regulatory Certification Data List"),
                    Characteristic16Bit(0x2AAD, "Indoor Positioning Configuration"),
                    Characteristic16Bit(0x2A36, "Intermediate Cuff Pressure"),
                    Characteristic16Bit(0x2A1E, "Intermediate Temperature"),
                    Characteristic16Bit(0x2A77, "Irradiance"),
                    Characteristic16Bit(0x2AA2, "Language"),
                    Characteristic16Bit(0x2A90, "Last Name"),
                    Characteristic16Bit(0x2AAE, "Latitude"),
                    Characteristic16Bit(0x2A6B, "LN Control Point"),
                    Characteristic16Bit(0x2A6A, "LN Feature"),
                    Characteristic16Bit(0x2AB1, "Local East Coordinate"),
                    Characteristic16Bit(0x2AB0, "Local North Coordinate"),
                    Characteristic16Bit(0x2A0F, "Local Time Information"),
                    Characteristic16Bit(0x2A67, "Location and Speed Characteristic"),
                    Characteristic16Bit(0x2AB5, "Location Name"),
                    Characteristic16Bit(0x2AAF, "Longitude"),
                    Characteristic16Bit(0x2A2C, "Magnetic Declination"),
                    Characteristic16Bit(0x2AA0, "Magnetic Flux Density - 2D"),
                    Characteristic16Bit(0x2AA1, "Magnetic Flux Density - 3D"),
                    Characteristic16Bit(0x2A29, "Manufacturer Name String"),
                    Characteristic16Bit(0x2A91, "Maximum Recommended Heart Rate"),
                    Characteristic16Bit(0x2A21, "Measurement Interval"),
                    Characteristic16Bit(0x2A24, "Model Number String"),
                    Characteristic16Bit(0x2A68, "Navigation"),
                    Characteristic16Bit(0x2A46, "New Alert"),
                    Characteristic16Bit(0x2AC5, "Object Action Control Point"),
                    Characteristic16Bit(0x2AC8, "Object Changed"),
                    Characteristic16Bit(0x2AC1, "Object First-Created"),
                    Characteristic16Bit(0x2AC3, "Object ID"),
                    Characteristic16Bit(0x2AC2, "Object Last-Modified"),
                    Characteristic16Bit(0x2AC6, "Object List Control Point"),
                    Characteristic16Bit(0x2AC7, "Object List Filter"),
                    Characteristic16Bit(0x2ABE, "Object Name"),
                    Characteristic16Bit(0x2AC4, "Object Properties"),
                    Characteristic16Bit(0x2AC0, "Object Size"),
                    Characteristic16Bit(0x2ABF, "Object Type"),
                    Characteristic16Bit(0x2ABD, "OTS Feature"),
                    Characteristic16Bit(0x2A5F, "PLX Continuous Measurement"),
                    Characteristic16Bit(0x2A60, "PLX Features"),
                    Characteristic16Bit(0x2A5E, "PLX Spot-Check Measurement"),
                    Characteristic16Bit(0x2A50, "PnP ID"),
                    Characteristic16Bit(0x2A75, "Pollen Concentration"),
                    Characteristic16Bit(0x2A69, "Position Quality"),
                    Characteristic16Bit(0x2A6D, "Pressure"),
                    Characteristic16Bit(0x2A4E, "Protocol Mode"),
                    Characteristic16Bit(0x2A78, "Rainfall"),
                    Characteristic16Bit(0x2A52, "Record Access Control Point"),
                    Characteristic16Bit(0x2A14, "Reference Time Information"),
                    Characteristic16Bit(0x2A4D, "Report"),
                    Characteristic16Bit(0x2A4B, "Report Map"),
                    Characteristic16Bit(0x2A92, "Resting Heart Rate"),
                    Characteristic16Bit(0x2A40, "Ringer Control Point"),
                    Characteristic16Bit(0x2A41, "Ringer Setting"),
                    Characteristic16Bit(0x2A54, "RSC Feature"),
                    Characteristic16Bit(0x2A53, "RSC Measurement"),
                    Characteristic16Bit(0x2A4F, "Scan Interval Window"),
                    Characteristic16Bit(0x2A31, "Scan Refresh"),
                    Characteristic16Bit(0x2A55, "SC Control Point"),
                    Characteristic16Bit(0x2A5D, "Sensor Location"),
                    Characteristic16Bit(0x2A25, "Serial Number String"),
                    Characteristic16Bit(0x2A28, "Software Revision String"),
                    Characteristic16Bit(0x2A93, "Sport Type for Aerobic and Anaerobic Thresholds"),
                    Characteristic16Bit(0x2A47, "Supported New Alert Category"),
                    Characteristic16Bit(0x2A48, "Supported Unread Alert Category"),
                    Characteristic16Bit(0x2A23, "System ID"),
                    Characteristic16Bit(0x2ABC, "TDS Control Point"),
                    Characteristic16Bit(0x2A6E, "Temperature"),
                    Characteristic16Bit(0x2A1C, "Temperature Measurement"),
                    Characteristic16Bit(0x2A1D, "Temperature Type"),
                    Characteristic16Bit(0x2A94, "Three Zone Heart Rate Limits"),
                    Characteristic16Bit(0x2A12, "Time Accuracy"),
                    Characteristic16Bit(0x2A13, "Time Source"),
                    Characteristic16Bit(0x2A16, "Time Update Control Point"),
                    Characteristic16Bit(0x2A17, "Time Update State"),
                    Characteristic16Bit(0x2A11, "Time with DST"),
                    Characteristic16Bit(0x2A0E, "Time Zone"),
                    Characteristic16Bit(0x2A71, "True Wind Direction"),
                    Characteristic16Bit(0x2A70, "True Wind Speed"),
                    Characteristic16Bit(0x2A95, "Two Zone Heart Rate Limit"),
                    Characteristic16Bit(0x2A07, "Tx Power Level"),
                    Characteristic16Bit(0x2AB4, "Uncertainty"),
                    Characteristic16Bit(0x2A45, "Unread Alert Status"),
                    Characteristic16Bit(0x2AB6, "URI"),
                    Characteristic16Bit(0x2A9F, "User Control Point"),
                    Characteristic16Bit(0x2A9A, "User Index"),
                    Characteristic16Bit(0x2A76, "UV Index"),
                    Characteristic16Bit(0x2A96, "VO2 Max"),
                    Characteristic16Bit(0x2A97, "Waist Circumference"),
                    Characteristic16Bit(0x2A98, "Weight"),
                    Characteristic16Bit(0x2A9D, "Weight Measurement"),
                    Characteristic16Bit(0x2A9E, "Weight Scale Feature"),
                    Characteristic16Bit(0x2A79, "Wind Chill"),
                    Characteristic16Bit(0x2ADB, "Mesh Provisioning Data In"),
                    Characteristic16Bit(0x2ADC, "Mesh Provisioning Data Out"),
                    Characteristic16Bit(0x2ADD, "Mesh Proxy Data In"),
                    Characteristic16Bit(0x2ADE, "Mesh Proxy Data Out")
            )
        }

        fun get16BitDescriptors(): List<Descriptor16Bit> {
            return arrayListOf(
                    Descriptor16Bit(0x2900, "Characteristic Extended Properties"),
                    Descriptor16Bit(0x2901, "Characteristic User Description"),
                    Descriptor16Bit(0x2902, "Client Characteristic Configuration"),
                    Descriptor16Bit(0x2903, "Server Characteristic Configuration"),
                    Descriptor16Bit(0x2904, "Characteristic Presentation Format"),
                    Descriptor16Bit(0x2905, "Characteristic Aggregate Format"),
                    Descriptor16Bit(0x2906, "Valid Range"),
                    Descriptor16Bit(0x2907, "External Report Reference"),
                    Descriptor16Bit(0x2908, "Report Reference"),
                    Descriptor16Bit(0x2909, "Number of Digitals"),
                    Descriptor16Bit(0x290A, "Value Trigger Setting"),
                    Descriptor16Bit(0x290B, "Environmental Sensing Configuration"),
                    Descriptor16Bit(0x290C, "Environmental Sensing Measurement"),
                    Descriptor16Bit(0x290D, "Environmental Sensing Trigger Setting"),
                    Descriptor16Bit(0x290E, "Time Trigger Setting"),
                    Descriptor16Bit(0x290F, "Complete BR-EDR Transport Block Data")
            )
        }

        fun getIndicateOrNotifyDescriptor(): Descriptor {
            return Descriptor(
                    name = "Client Characteristic Configuration",
                    uuid = Uuid("2902"),
                    value = Value("0000", Value.Type.HEX, 2),
                    isPredefined = true,
                    properties = setOf(Property.READ, Property.WRITE)
            )
        }

        fun getReliableWriteDescriptor(): Descriptor {
            return Descriptor(
                    name = "Characteristic Extended Properties",
                    uuid = Uuid("2900"),
                    value = Value("0100", Value.Type.HEX, 2),
                    isPredefined = true)
        }
    }
}
